package me.zhengjie.common.utils.cypto

import me.zhengjie.common.utils.MD5Util.md5
import java.util.*

/**
 * 系统密钥生成类
 *
 * @author Mrxiao
 */
object CipherUtil {
    /**
     * 生成app_key
     *
     * @return
     */
    fun createAppKey(): String {
        return "wx" + UUID.randomUUID().toString().trim { it <= ' ' }.replace("-".toRegex(), "")
    }

    /**
     * 生成 app_screct 密钥
     *
     * @param appkey
     * @return
     */
    fun createAppScrect(appkey: String?): String {
        val sb_screct = StringBuilder()
        sb_screct.append(System.currentTimeMillis())
        sb_screct.append(appkey)
        sb_screct.append(System.currentTimeMillis())
        sb_screct.append("YIDING")
        sb_screct.append(System.currentTimeMillis())
        sb_screct.append("不用想啦,反正你也猜不到的")
        return md5(sb_screct.toString())
    } /*public static void main(String[] args) {
		String app_key = createAppKey();
		String app_screct = createAppScrect(app_key);
		System.out.println("====>app_key:" + app_key);
		System.out.println("====>app_screct:" + app_screct);
	}*/
}